 {

        var o = require("../UISoundManager.js"), i = require("../UIPopupBase.js");
        cc.Class({
            extends: i,
            properties: {
                nodeTaskItem: {
                    default: null,
                    type: cc.Prefab
                },
                layoutContent: {
                    default: null,
                    type: cc.Layout
                },
                _shareRewardTaskID: null
            },
            init: function () {
                var e = Global.configCdn.getActivityAndTaskConf() || Global.configCdn.getDefaultConfig("activityAndTask");
                this._taskkinds = [];
                for (var t = 0; t < e.taskkinds.length; t++) this._taskkinds.push(e.taskkinds[t]);
                for (var n = this._taskkinds.length - 1; n >= 0; n--) Global.config.undoKindIdInTask[this._taskkinds[n].kindId] && this._taskkinds.splice(n, 1);
            },
            onLoad: function () {
                Global.notificationCenter.on(Global.eventName.MSG_HAPPYBAG5, this.bindData.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.MSH_SHARE5, this.shareCallback.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.MSG_SHOW_REWARD_RANDOM, this.showRandomReward.bind(this), this),
                    Global.notificationCenter.emit(Global.eventName.MSG_SET_UNDO_RECEIVE, !0), Global.msgHandler.requestTaskData();
            },
            showRandomReward: function (e) {
                console.log("TaskPanel showRandomReward", e), this._shareRewardTaskID = e;
            },
            pullPrize: function (e) {
                if (console.log("pullPrize data=", e), e) if (e.error) Global.utils.showNodeCommon(e.error.info, 3); else {
                    var t = "恭喜分享成功，获得" + e.result.shareRewards + "金币";
                    o.playReward(), Global.utils.showNodeCommon(t, 1.5);
                }
            },
            bindData: function (e) {
                if (Global.utils.hideWaitting(), e) {
                    console.log("bindData result:", e);
                    var t = this;
                    if ("list" == e.action) this._tasks = e.tasks; else if ("getreward" == e.action) {
                        var n = null;
                        if (e.todotasks && e.todotasks.params && e.todotasks.params.rewards && (n = e.todotasks.params.rewards[0]),
                        null == n) return void console.error("rewards :", n, e);
                        var o = function () {
                            t._shareRewardTaskID = null, Global.msgHandler.requestTaskData();
                        }, i = this._shareRewardTaskID;
                        cc.loader.load({
                            url: n.pic,
                            type: "png"
                        }, function (e, t) {
                            try {
                                var a = {
                                    reward: n.count,
                                    pic: new cc.SpriteFrame(t),
                                    name: n.name,
                                    type: "task"
                                };
                                Global.UIPopupManager.addPopup("PopupPanel/Panel_shareGroup_Reward", function (e) {
                                    e.getComponent("shareGroup_RewardPanel").setData(a, o, i);
                                });
                            } catch (e) {
                                cc.error("TaslPanel", "Error = " + e);
                            }
                        });
                    }
                    this.createTaskItem();
                }
            },
            shareCallback: function (e) {
                e && 1 == e.ok && (Global.utils.showNodeCommon("分享成功", 3), Global.msgHandler.requestTaskData());
            },
            createTaskItem: function () {
                if (this._tasks) for (var e = 0, t = 0; t < this._taskkinds.length; t++) {
                    var n = this._taskkinds[t];
                    if (cc.sys.platform == cc.sys.WECHAT_GAME || "每日分享" != n.name) {
                        if (console.log("createTaskItem i :", t, n.kindId), console.log("createTaskItem2222 i :", this.layoutContent.node.childrenCount, this._taskkinds.length),
                        this.layoutContent.node.childrenCount < this._taskkinds.length) {
                            var o = cc.instantiate(this.nodeTaskItem);
                            this.layoutContent.node.addChild(o);
                        }
                        for (var i = this.layoutContent.node.children[t].getComponent("NodeTaskItem"), a = null, r = 0; r < this._tasks.length; r++) if (n.kindId == this._tasks[r][1]) {
                            a = this._tasks[r];
                            break;
                        }
                        i.bindData(this._taskkinds[e], a), e++;
                    }
                }
            },
            OnPanelClose: function () {
                o.playEffect("select"), this.closePanel();
            },
            onDestroyHook: function () {
                Global.notificationCenter.emit(Global.eventName.MSG_SET_UNDO_RECEIVE, !1);
            }
        })
    }